//
//  Interpolate.swift
//  PageNavigator
//
//  Created by 张奇 on 2025/8/14.
//

import UIKit

public class Interpolate {
    
    /// 差值函数
    /// - Parameters:
    ///   - from: 开始
    ///   - to: 目标
    ///   - percent: 百分比, 0 和 1之间
    /// - Returns: 差值计算数据
    public static func interpolate(from: CGFloat, to:  CGFloat, percent:  CGFloat) -> CGFloat {
        
        let percent = max(0, min(1, percent))
        return from + (to - from) * percent
    }
}
